package com.amphora.model;

import java.io.Serializable;
import java.util.Calendar;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name="booking")
public class Booking implements Serializable{

	private static final long serialVersionUID = -1500663222941566753L;
	
	@Id @GeneratedValue
	@Column(name="id")
	private Long id;
	
	@Column(name="appointment_date")
	private Calendar appointmentDate;

	@Column(name="approved")
	private String approved;
	
	@OneToMany(fetch = FetchType.LAZY,cascade=CascadeType.ALL,mappedBy="booking")
	private List<Treatment> treatments;

	@OneToOne
	@JoinColumn(name="client_id")
	private User user;
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Calendar getAppointmentDate() {
		return appointmentDate;
	}

	public void setAppointmentDate(Calendar appointmentDate) {
		this.appointmentDate = appointmentDate;
	}

	public String getApproved() {
		return approved;
	}

	public void setApproved(String approved) {
		this.approved = approved;
	}

	
	public List<Treatment> getTreatments() {
		return treatments;
	}

	public void setTreatments(List<Treatment> treatments) {
		this.treatments = treatments;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User User) {
		this.user = User;
	}
	
	public static String getClassName(){
		return "com.amphora.model.Booking";
	}

	@Override
	public String toString() {
		return "Booking [id=" + id + ", appointmentDate=" + appointmentDate
				+ ", approved=" + approved + "]";
	}
	
	
}
